﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Program06
{
    /// <summary>
    /// 商品类
    /// </summary>
     class Commodity
    {
        float price;//商品价格
        public float Price { get => price; set => price = value < 0 ? 0 : value; }

        public float AllPrice => Price * Count;//购买商品总价

        public string Name { get; }//商品名称


        int count;//商品数量
        public int Count { get => count; set => count = value < 0 ? 0 : value; }

        public Commodity(string name, float price, int count)
        {
            Name = name;
            Price = price;
            Count = count;
        }
    }
}
